****************
*** Fig. A.8 ***
****************
* load frame
frame change italian_data

************ Public institutions employees 2001 ***************

* n. associations, dummy unemployment change

reg mainstream i.worse_econ##c.associations##i.declining_emp##c.dipendenti_istituzioni_pub_2001 i.education age i.male i.election_year i.provincen, vce(cluster province)

margins declining_emp, dydx(worse_econ) at(associations=(0(4)16))
mplotoffset,  offset(0.5) recast(scatter) ///
		title("") ///
		ytitle("Mainstream vote", size(large)) ///
		xtitle("Number of associations", size(large)) ///		
		yline(0, lw(thin) lstyle(foreground) ) ///
		ylabel(, grid glcolor(black%70) glw(thin) labs(medl)) ///
		xlabel(, nogrid) ///
		aspect(1) ///
		plot1opts(msymbol(D) msize(medium) mcolor(red) lcolor(red) lwidth(medthick)) ci1opts(lcolor(red)) ///
        plot2opts(msymbol(O) msize(medium) mcolor(blue) lp(solid)  mlcolor(blue) lcolor(blue) lwidth(medthick)) ci2opts(lcolor(blue)) ///
		legend( ///
			region(lwidth(none)) ///
			col(2) ///
			position(6) ///
			order(3 "Declining unemployment" 4 "Increasing unemployment"))	
graph addplot histogram associations, ///
	yaxis(2) ///
	yscale(range(0 1) off axis(2)) ///
	xlabel(0(4)24) ///
	color(black%10) ///
		legend( ///
			region(lwidth(none)) ///
			col(2) ///
			position(6) ///
			order(3 "Declining unemployment" 4 "Increasing unemployment"))	
graph export "$folder/replication/figures/figA8a.pdf", replace

* n. coni association, dummy unemployment change

reg mainstream i.worse_econ##c.coni_assoc_1999##i.declining_emp##c.istituzioni_pub_2001 i.education age i.male i.election_year i.regionen, vce(cluster regionen)

margins declining_emp, dydx(worse_econ) at(coni_assoc_1999=(0.5(.4)2.1))
mplotoffset,  offset(0.05) recast(scatter) ///
		title("") ///
		ytitle("Mainstream vote", size(large)) ///
		xtitle("Number of sports clubs", size(large)) ///		
		yline(0, lw(thin) lstyle(foreground) ) ///
		ylabel(, grid glcolor(black%70) glw(thin) labs(medl)) ///
		xlabel(, nogrid) ///
		aspect(1) ///
		plot1opts(msymbol(D) msize(medium) mcolor(red) lcolor(red) lwidth(medthick)) ci1opts(lcolor(red)) ///
        plot2opts(msymbol(O) msize(medium) mcolor(blue) lp(solid)  mlcolor(blue) lcolor(blue) lwidth(medthick)) ci2opts(lcolor(blue)) ///
		legend( ///
			region(lwidth(none)) ///
			col(2) ///
			position(6) ///
			order(3 "Declining unemployment" 4 "Increasing unemployment"))	
graph addplot histogram coni_assoc_1999, ///
	yaxis(2) ///
	yscale(range(0 10) off axis(2)) ///
	xlabel(0.1(0.4)2.5) ///
	color(black%10) ///
		legend( ///
			region(lwidth(none)) ///
			col(2) ///
			position(6) ///
			order(3 "Declining unemployment" 4 "Increasing unemployment"))	
graph export "$folder/replication/figures/figA8b.pdf", replace

* n. associations, unemployment change tercile
	
reg mainstream i.worse_econ##c.associations##i.unemp_tercile##c.dipendenti_istituzioni_pub_2001 i.education age i.male i.election_year i.regionen, vce(cluster province)

margins unemp_tercile, dydx(worse_econ) at(associations=(0(4)16))
mplotoffset,  offset(0.5) recast(scatter) ///
		title("") ///
		ytitle("Mainstream vote", size(large)) ///
		xtitle("Number of associations", size(large)) ///		
		yline(0, lw(thin) lstyle(foreground) ) ///
		ylabel(, grid glcolor(black%70) glw(thin) labs(medl)) ///
		xlabel(, nogrid) ///
		aspect(1) ///
		plot1opts(msymbol(D) msize(medium) mcolor(red) lcolor(red) lwidth(medthick)) ci1opts(lcolor(red)) ///
        plot3opts(msymbol(O) msize(medium) mcolor(blue) lp(solid)  mlcolor(blue) lcolor(blue) lwidth(medthick)) ci3opts(lcolor(blue)) ///
        plot2opts(msymbol(T) msize(medium) mcolor(orange) lp(solid)  mlcolor(orange) lcolor(orange) lwidth(medthick)) ci2opts(lcolor(orange)) ///
		legend( ///
			region(lwidth(none)) ///
			col(3) ///
			position(6) ///
			order(4 "Low unemployment change" 5 "Mid unemployment change" 6 "High unemployment change"))
graph addplot histogram associations, ///
	yaxis(2) ///
	yscale(range(0 1) off axis(2)) ///
	xlabel(0(4)24) ///
	color(black%10) ///
		legend( ///
			region(lwidth(none)) ///
			col(3) ///
			position(6) ///
			order(4 "Low unemployment change" 5 "Mid unemployment change" 6 "High unemployment change"))
graph export "$folder/replication/figures/figA8c.pdf", replace
	
* n. coni association, unemployment change tercile

reg mainstream i.worse_econ##c.coni_assoc_1999##i.unemp_tercile##c.istituzioni_pub_2001 i.education age i.male i.election_year i.regionen, vce(cluster regionen)

margins unemp_tercile, dydx(worse_econ) at(coni_assoc_1999=(0.5(.4)2.1))
mplotoffset,  offset(0.05) recast(scatter) ///
		title("") ///
		ytitle("Mainstream vote", size(large)) ///
		xtitle("Number of sports clubs", size(large)) ///		
		yline(0, lw(thin) lstyle(foreground) ) ///
		ylabel(, grid glcolor(black%70) glw(thin) labs(medl)) ///
		xlabel(, nogrid) ///
		aspect(1) ///
		plot1opts(msymbol(D) msize(medium) mcolor(red) lcolor(red) lwidth(medthick)) ci1opts(lcolor(red)) ///
        plot3opts(msymbol(O) msize(medium) mcolor(blue) lp(solid)  mlcolor(blue) lcolor(blue) lwidth(medthick)) ci3opts(lcolor(blue)) ///
        plot2opts(msymbol(T) msize(medium) mcolor(orange) lp(solid)  mlcolor(orange) lcolor(orange) lwidth(medthick)) ci2opts(lcolor(orange)) ///
		legend( ///
			region(lwidth(none)) ///
			col(3) ///
			position(6) ///
			order(4 "Low unemployment change" 5 "Mid unemployment change" 6 "High unemployment change"))
graph addplot histogram coni_assoc_1999, ///
	yaxis(2) ///
	yscale(range(0 10) off axis(2)) ///
	xlabel(0.1(0.4)2.5) ///
	color(black%10) ///
		legend( ///
			region(lwidth(none)) ///
			col(3) ///
			position(6) ///
			order(4 "Low unemployment change" 5 "Mid unemployment change" 6 "High unemployment change"))
graph export "$folder/replication/figures/figA8d.pdf", replace
